package previous.Test_0322;

import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 */
public class Test {
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int[] dp=new int[17];
        for (int i = 1; i <=16 ; i++) {
            dp[i]=dp[i-1]+i;
        }
        System.out.println(dp[16]);
        scan.close();
    }
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String s=scan.nextLine();
        char[] c=s.toCharArray();
        int count=0;
        int i=0;
        int left=0;
        boolean t=false;
        while(i<c.length){

            for (int j = i+1; j < s.length(); j++) {
                if(c[j]=='a'){
                for (int k = j+1; k < s.length(); k++) {
                    if(c[k]=='n'){
                        count++;
                    }
                    if(c[k]=='l'){
                       left=k;
                       t=true;
                    }
                }
                }
            }
            if(t==true){
                i=left;
                t=false;
            }else {
               break;
            }
        }
        System.out.println(count);
        scan.close();
    }
    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n=scan.nextInt();
        int[][] a=new int[n][2];
        long sum=0;
        PriorityQueue<Integer> q1=new PriorityQueue<>((x,y) -> y-x);
        PriorityQueue<Integer> q2=new PriorityQueue<>((x,y) -> y-x);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 2; j++) {
                a[i][j]=scan.nextInt();
            }
            int x=a[i][0];
            int y=a[i][1];
            if(x>y){
                q1.offer(x);
                if(q1.size()>n/2){
                    q1.poll();
                    q2.offer(y);
                }
            }else{
                q2.offer(y);
                if(q1.size()>n-n/2){
                    q2.poll();
                    q1.offer(x);
                }
            }
        }
        for (Integer w:q1) {
            sum+=w;
        }
        for (Integer v:q2) {
            sum+=v;
        }
        System.out.println(sum);
        scan.close();
    }
    public static void main4(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String s=scan.nextLine();
        char[] c=s.toCharArray();
        long countl=0,counta=0,countn=0;
        for (int i = 0; i < c.length; i++) {
            if(c[i]=='l'){
                countl++;
            }else if(c[i]=='a'){
                counta+=countl;
            }else if(c[i]=='n'){
                countn+=counta;
            }
        }
        System.out.println(countn);
        scan.close();
    }
    //寻找2020

}
